<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>strategy::buffer::distance_asymmetric</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Geometry">
<link rel="up" href="../strategies.html" title="Strategies">
<link rel="prev" href="strategy_buffer_distance_symmetric.html" title="strategy::buffer::distance_symmetric">
<link rel="next" href="strategy_buffer_point_circle.html" title="strategy::buffer::point_circle">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="strategy_buffer_distance_symmetric.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../strategies.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="strategy_buffer_point_circle.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric"></a><a class="link" href="strategy_buffer_distance_asymmetric.html" title="strategy::buffer::distance_asymmetric">strategy::buffer::distance_asymmetric</a>
</h4></div></div></div>
<p>
          <a class="indexterm" name="idm45246411792368"></a><a class="indexterm" name="idm45246411791680"></a><a class="indexterm" name="idm45246411790992"></a>
Let the buffer for linestrings be asymmetric.
        </p>
<h6>
<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h0"></a>
          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.synopsis"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.synopsis">Synopsis</a>
        </h6>
<p>
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">NumericType</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">distance_asymmetric</span>
<span class="special">{</span>
  <span class="comment">// ...</span>
<span class="special">};</span>
</pre>
<p>
        </p>
<h6>
<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h1"></a>
          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.template_parameter_s_"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.template_parameter_s_">Template
          parameter(s)</a>
        </h6>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                  <p>
                    Parameter
                  </p>
                </th>
<th>
                  <p>
                    Description
                  </p>
                </th>
</tr></thead>
<tbody><tr>
<td>
                  <p>
                    typename NumericType
                  </p>
                </td>
<td>
                  <p>
                    numerical type (int, double, ttmath, ...)
                  </p>
                </td>
</tr></tbody>
</table></div>
<h6>
<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h2"></a>
          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.constructor_s_"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.constructor_s_">Constructor(s)</a>
        </h6>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                  <p>
                    Function
                  </p>
                </th>
<th>
                  <p>
                    Description
                  </p>
                </th>
<th>
                  <p>
                    Parameters
                  </p>
                </th>
</tr></thead>
<tbody><tr>
<td>
                  <p>
</p>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">distance_asymmetric</span><span class="special">(</span><span class="identifier">NumericType</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">left</span><span class="special">,</span> <span class="identifier">NumericType</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">right</span><span class="special">)</span></pre>
<p>
                  </p>
                </td>
<td>
                  <p>
                    Constructs the strategy, two distances must be specified.
                  </p>
                </td>
<td>
                  <p>
                    <span class="bold"><strong>NumericType const &amp;</strong></span>: <span class="emphasis"><em>left</em></span>:
                    The distance (or radius) of the buffer on the left side
                  </p>
                  <p>
                    <span class="bold"><strong>NumericType const &amp;</strong></span>: <span class="emphasis"><em>right</em></span>:
                    The distance on the right side
                  </p>
                </td>
</tr></tbody>
</table></div>
<h6>
<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h3"></a>
          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.header"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.header">Header</a>
        </h6>
<p>
          <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">strategies</span><span class="special">/</span><span class="identifier">agnostic</span><span class="special">/</span><span class="identifier">buffer_distance_asymmetric</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
        </p>
<h6>
<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h4"></a>
          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.example"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.example">Example</a>
        </h6>
<p>
          Shows how the distance_asymmetric strategy can be used as a DistanceStrategy
          to create asymmetric buffers
        </p>
<p>
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">point_xy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>


<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
<span class="special">{</span>
    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">point</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">linestring</span><span class="special">&lt;</span><span class="identifier">point</span><span class="special">&gt;</span> <span class="identifier">linestring</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">polygon</span><span class="special">&lt;</span><span class="identifier">point</span><span class="special">&gt;</span> <span class="identifier">polygon</span><span class="special">;</span>

    <span class="comment">// Declare the asymmetric distance strategy</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">distance_asymmetric</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">distance_strategy</span><span class="special">(</span><span class="number">1.0</span><span class="special">,</span> <span class="number">0.5</span><span class="special">);</span>

    <span class="comment">// Declare other strategies</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">side_straight</span> <span class="identifier">side_strategy</span><span class="special">;</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">join_round</span> <span class="identifier">join_strategy</span><span class="special">;</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">end_round</span> <span class="identifier">end_strategy</span><span class="special">;</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">point_circle</span> <span class="identifier">point_strategy</span><span class="special">;</span>

    <span class="comment">// Declare/fill a multi linestring</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">multi_linestring</span><span class="special">&lt;</span><span class="identifier">linestring</span><span class="special">&gt;</span> <span class="identifier">ml</span><span class="special">;</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"MULTILINESTRING((3 5,5 10,7 5),(7 7,11 10,15 7,19 10))"</span><span class="special">,</span> <span class="identifier">ml</span><span class="special">);</span>

    <span class="comment">// Create the buffered geometry with left/right a different distance</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">multi_polygon</span><span class="special">&lt;</span><span class="identifier">polygon</span><span class="special">&gt;</span> <span class="identifier">result</span><span class="special">;</span>
    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">ml</span><span class="special">,</span> <span class="identifier">result</span><span class="special">,</span>
                <span class="identifier">distance_strategy</span><span class="special">,</span> <span class="identifier">side_strategy</span><span class="special">,</span>
                <span class="identifier">join_strategy</span><span class="special">,</span> <span class="identifier">end_strategy</span><span class="special">,</span> <span class="identifier">point_strategy</span><span class="special">);</span>


    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
        </p>
<h6>
<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h5"></a>
          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.output"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.output">Output</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../../img/strategies/buffer_distance_asymmetric.png" alt="buffer_distance_asymmetric"></span>
        </p>
<h6>
<a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.h6"></a>
          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_distance_asymmetric.see_also"></a></span><a class="link" href="strategy_buffer_distance_asymmetric.html#geometry.reference.strategies.strategy_buffer_distance_asymmetric.see_also">See
          also</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <a class="link" href="../algorithms/buffer/buffer_7_with_strategies.html" title="buffer (with strategies)">buffer
              (with strategies)</a>
            </li>
<li class="listitem">
              <a class="link" href="strategy_buffer_distance_symmetric.html" title="strategy::buffer::distance_symmetric">distance_symmetric</a>
            </li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2021 Barend Gehrels,
      Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="strategy_buffer_distance_symmetric.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../strategies.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="strategy_buffer_point_circle.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
